#include <stdio.h>
#include <stdlib.h>
#include <string.h>


/**
 * @brief 
 * i 为下标，返回值应该加1
 * @param nums 
 * @param numsSize 
 * @return int 
 */
int removeDuplicates(int* nums, int numsSize){
    if (numsSize == 0) return 0;
    if (numsSize == 1) return 1;
    int i = 0, j = 1;
    while (j < numsSize)
    {
        if (nums[i] != nums[j])
        {
            nums[i+1] = nums[j];
            i++;
        }
        j++;
    }
    return i + 1;
    
}

int main(void)
{
    int nums[] = {0,0,1,1,1,2,2,3,3,4};
    int result = removeDuplicates(nums,10);
    for (size_t i = 0; i < 10; i++)
    {
        printf("%d ",nums[i]);
    }
    printf("\n %d \n",result); 
    return 0;
}